import socket
# fo = open("foot.txt","wb")
# print("文件名:",fo.name)
# print("是否已关闭:",fo.closed)
# print("访问模式:",fo.mode)

# print("末尾是否强制加空格:",fo.softspace)

# fo = open("foo.txt", "wb")
# print("文件名:",fo.name)
# print(fo.write)
# fo.write( "Python is a great language.\nYeah its great!!\n");
# fo.close()
# f = open('demo.txt', 'w')
# f.write('keer')
# f.close()
#
# fo = open("foo123.txt", "r+")
# fo.write('可儿是一个特别好的女孩，我也特别喜欢她')
# str = fo.read();
# print ("读取的字符串是: ", str)
# # 关闭打开的文件
# fo.close()


fo = open("foo456.txt", "r+")
fo.write('你们只知道可儿很漂亮，但是你们知道她很温柔吗？')
str = fo.read();
print("读取的字符串是: ", str)

# 查找当前位置
position = fo.tell();
print("当前文件位置: ", position)

# 把指针再次重新定位到文件开头
position = fo.seek(0, 0);
str = fo.read(10);
print("重新读取字符串: ", str)
# 关闭打开的文件
fo.close()

